﻿<?php
include("connect.php");
$UserID=$_REQUEST['UserID'];
$sql="SELECT User.UserUrl,User.UserName,Dynamic.PunTime,Dynamic.PunCon,Activities.ActName FROM Activities,Dynamic,User where Activities.ActID=Dynamic.ActID AND Dynamic.UserID=User.UserID AND Dynamic.UserID='".$UserID."'";
mysqli_query($conn,"set names utf8mb4");
$result=mysqli_query($conn,$sql);
$data=array();
class dynamic{
        public $UserUrl;
        public $UserName;
	public $PunTime;
	public $PunCon;
	public $ActName;
	
}
mysqli_query($conn,"set names utf8mb4");

while($row=mysqli_fetch_array($result,MYSQL_ASSOC)){
	$dyn=new dynamic();
        //将字符串以url编码(主要将中文转化过去
        $dyn->UserUrl=urlencode($row["UserUrl"]);
        $dyn->UserName=urlencode($row["UserName"]);
	$dyn->PunTime=urlencode($row["PunTime"]);
	$dyn->PunCon=urlencode(str_replace('<br>','\n',$row["PunCon"]));
	$dyn->ActName=urlencode($row["ActName"]);
	$data[]=$dyn;
  
}
array_multisort($data,SORT_DESC );
//将数值转换成json数据存储格式
$json=json_encode($data);
echo urldecode($json);
?>
